<?php

include_once($_SERVER['DOCUMENT_ROOT'] . '/htqlmba/configs/Database.php');

class Tram extends Database {

    private $MA_TRAM;
    private $TEN_TRAM;
    private $DIA_CHI_TRAM;

    public function setMA_TRAM($MA_TRAM) {
        $this->MA_TRAM = $MA_TRAM;
    }

    public function getMA_TRAM() {
        return $this->MA_TRAM;
    }

    public function setTEN_TRAM($TEN_TRAM) {
        $this->TEN_TRAM = $TEN_TRAM;
    }

    public function getTEN_TRAM() {
        return $this->TEN_TRAM;
    }

    public function setDIA_CHI_TRAM($DIA_CHI_TRAM) {
        $this->DIA_CHI_TRAM = $DIA_CHI_TRAM;
    }

    public function getDIA_CHI_TRAM() {
        return $this->DIA_CHI_TRAM;
    }

    // function them tram

    public function themTram() {
        $query = "insert into tram(MA_TRAM,TEN_TRAM,DIA_CHI_TRAM) 
            values ('" . $this->getMA_TRAM() . "','" . $this->getTEN_TRAM() . "','" . $this->getDIA_CHI_TRAM() . "')";
        $this->setQuery($query);
        return $this->executeQuery();
    }

    public function suaTram() {

        $query = "	update tram 
						set MA_TRAM='" . $this->getMA_TRAM() . "',
						TEN_TRAM='" . $this->getTEN_TRAM() . "',
						DIA_CHI_TRAM='" . $this->getDIA_CHI_TRAM() . "'
						where MA_TRAM='" . $this->getMA_TRAM() . "' ";
        $this->setQuery($query);
        return $this->executeQuery();
    }

    public function xoaTram() {
        $this->setQuery("delete from tram where  MA_TRAM='" . $this->getMA_TRAM() . "'");
        return $this->executeQuery();
    }

    public function dsTram() {
        $this->setQuery("select MA_TRAM,TEN_TRAM,DIA_CHI_TRAM
							 from tram
ORDER BY `tram`.`MA_TRAM` DESC
							 ");
        return $this->fetchAll();
    }

}

?>